Along with the advancement of the supercomputer, application programs, which are executed on the super computer, becomes complicated. For example, a processing (e.g. simple DO loop processing) to repeatedly perform a single processing content along a space axis and/or time axis was a main stream, however, now, the processing content is changed according to individual spaces and/or the processing content is changed according to the time progress. In other words, an application program, which includes a processing to cope with various conditions (which correspond to IF sentences in the program codes) in the loop processing, is developed to execute much realistic simulation on the computer. Then, one object in this field is how to execute the application program, which complexly works as described above, on the high-performance computer at high speed.
As a method for speeding up the execution of codes that include the IF sentence in a DO loop by compiler optimization, there exists an acceleration method using a predicated instruction and an acceleration method by generating a list vector.
For example, in case of the DO loop that includes an IF sentence as illustrated in FIG. 1A, codes as illustrated in FIG. 1B are generated, typically. In other words, the codes are generated so that, if x(i)>0 is true, instructions surrounded with “TRUE” are executed, and if x(i)>0 is false, instructions for the FALSE case are executed by jumping to a line “L0” from a branch instruction fble. On the other hand, when the predicated instruction is used, codes are generated as illustrated in FIG. 1C. As illustrated in a dotted-line rectangle in FIG. 1C, the codes are generated so that, the branch instruction is not included and the instructions for the TRUE case and the instructions for the FALSE case are always executed, and if x(i)>0 is false, a predicated “store” instruction for the TRUE case is cancelled and a computational result for the TRUE case is discarded.
Therefore, for example, in case of the code that no processing is performed in case of the FALSE case for the IF sentence in the DO loop, as illustrated in FIG. 2, when the condition of the IF sentence is always determined to be true, in other words, when a true rate (=(the number of times of execution of the instructions for the TRUE case)/(the number of times of execution of the DO loop)) is 100%, all of the executed instructions are effective. On the other hand, for example, when the true rate is not 100%, however, is high like 90%, there are a lot of effective instructions “a” among the executed instructions. However, redundant instructions partially appear. Then, when the true rate becomes low like 10%, the number of effective instructions becomes lesser and the redundant instructions “b” increases. In other words, when the true rate is not high, a lot of computational results are discarded. Accordingly, an effect of high efficiency of the instruction execution cannot be obtained.
According to this method, in case where the DO loop is repeatedly executed as illustrated in FIG. 3A, when the true rate is high and almost constant, the number of effective instructions increases entirely, and the effect of the acceleration can be obtained. On the other hand, as illustrated in FIG. 3B, when the true rate is low and almost constant, the number of redundant instructions increases entirely, and the effect of the acceleration cannot be obtained, entirely. Thus, when the true rate is almost constant, the method using the predicated instruction is effective if the true rate is high. However, as illustrated in FIG. 3C, when a situation that the true rate largely changes occurs while the DO loop is executed repeatedly, there is a problem that the efficiency of the instruction execution largely decreases on the way of the execution. When the predicated instruction is used, as schematically illustrated in FIGS. 3A to 3C, the processing time itself is constant regardless of the true rate, and the efficiency of the instruction execution changes.
Moreover, as for the DO loop including the IF sentence as illustrated in FIG. 4A, when there are instructions in the TRUE case and there is no instruction in the FALSE case, codes as schematically illustrated in FIG. 4B are generated according to the method that generates the list vector. In other words, a code “c” for a loop that an index i in the case where the condition of the IF sentence is true is set to a list vector index(jjj) and a code “d” for a loop (also called “a list vector loop”) to repeat computation only for the index i set in the list vector index(jjj) are generated. Namely, an IF clause and a THEN clause are separated, and the THEN clause without any branch instruction is speeded up.
In the method for generating the list vector as described above, the code “c” for generating the list vector is always executed regardless of the true rate. However, as schematically illustrated in FIG. 5A, the number of indices that are included in the list vector becomes greater when the true rate is high like 90%, for example, and the processing time for the list vector loop becomes long. On the other hand, as schematically illustrated in FIG. 5B, the number of indices that are included in the list vector becomes lesser when the true rate is low like 10%, for example, the processing time for the list vector loop is shortened. Thus, when there are instructions if the condition of the IF sentence is TRUE and there is no instruction if the condition is FALSE, the processing time is shortened if the true rate is lower. When the state where the true rate is low is kept as described above, it is efficient to employ the method for generating the list vector. However, as illustrated in FIG. 5C, even if the efficient execution is initially performed because the true rate is low, when the situation is changed on the way of the execution to a situation that the true rate increases, the execution is not entirely performed efficiently.
No conventional arts propose any method to cope with such a problem.
Patent Document 1: Japanese Laid-open Patent Publication No. 59-165147